﻿@{
    ViewBag.Title = "Home Page";
    Layout = "";
}

<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录页面</title>
    <script type="text/javascript" src="http://js.40017.cn/cn/min/??/cn/sl/snapping/zepto.js?v=2016"></script>
    <!-- 引入vue脚本 -->
    <script type="text/javascript" src="https://unpkg.com/vue/dist/vue.js"></script>
    <!--自定义样式-->
    <style type="text/css">
        * {
            margin: 0;
            padding: 0;
        }

        body,
        html {
            width: 100%;
            height: 100%;
            min-width: 1386px;
        }

        input, select, textarea, button {
            vertical-align: middle;
            font-size: 100%;
            font-family: "Microsoft Yahei";
            outline: 0;
        }

        .page {
            width: 100%;
            height: 100%;
            background: url("@Url.Content("~/Content/images/pattern4.png")") repeat;
            position: relative;
        }

        .img1 {
            display: block;
            width: 396px;
            height: 326px;
            position: absolute;
            top: 0;
            left: 0;
        }

        .img2 {
            display: block;
            width: 500px;
            height: 500px;
            position: absolute;
            top: 150px;
            right: 0;
        }

        .loginBox {
            padding: 50px 20px 0;
            width: 270px;
            height: 240px;
            position: absolute;
            top: 50%;
            left: 50%;
            margin: -145px 0 0 -140px;
            background: #fff;
        }

        .login_name, .login_password {
            color: #999;
            width: 268px;
            height: 32px;
            border: 1px solid #ddd;
            background: #fff;
            position: relative;
            margin-bottom: 19px;
            border-radius: 3px;
            padding-top: 1px;
        }

            .login_name i {
                background: url(http://pic4.40017.cn/index/slide/2016/07/20/12/1IqtjF.png) no-repeat;
                width: 16px;
                height: 22px;
                display: block;
                background-position: -1px -208px;
                float: left;
                border-right: 1px solid #ddd;
                padding-right: 10px;
                margin: 6px 5px 0 10px;
            }

            .login_password i {
                background: url(http://pic4.40017.cn/index/slide/2016/07/20/12/1IqtjF.png) no-repeat;
                width: 16px;
                height: 22px;
                display: block;
                float: left;
                border-right: 1px solid #ddd;
                background-position: -133px -187px;
                padding-right: 10px;
                margin: 6px 5px 0 10px;
            }

            .login_name input, .login_password input {
                width: 218px;
                background: #fff;
                color: #333;
                border: 0;
                padding: 6px 0 5px 5px;
                font-family: "Microsoft Yahei";
                border-radius: 5px;
            }

        .btn_sign_in {
            width: 270px;
            height: 42px;
            display: block;
            background-color: #ff7800;
            border-radius: 3px;
            text-align: center;
            line-height: 42px;
            color: #fff;
            font-size: 20px;
            margin: 40px 0 7px;
            cursor: pointer;
            text-decoration: none;
        }
    </style>
</head>
<body>
    <div class="page">
        <img src="http://file.40017.cn/leonidbucket/skin_spring/img/hdenglong.png" class="img1">
        <img src="http://file.40017.cn/leonidbucket/skin_spring/img/denglong.png" class="img2">
        <div class="loginBox">
            <div class="comm_cont">
                <div class="login_name" style="border: 1px solid rgb(221, 221, 221);">
                    <i></i>
                    <input type="text" maxlength="30" id="name" name="name" placeholder="输入用户名" style="color: rgb(153, 153, 153);" v-model="message">
                </div>
                <div class="login_password">
                    <i></i>
                    <input type="password" maxlength="20" name="pass" id="password" placeholder="输入密码" v-model="message">
                </div>
                <a href="javascript:void(0);" class="btn_sign_in" id="btn_sign_in" onclick = "logon()" >登&nbsp;录</a>
            </div>
        </div>
    </div>
</body>
<script type="text/javascript">

    var loginName = new Vue({
        el: '.login_name',
        data: {
            message: ''
        }
    })

    var password = new Vue({
        el: '.login_password',
        data: {
            message: ''
        }
    });

    function logon() {
        var name = $("#name").val();
        var password = $("#password").val();
        var url = "@Url.Content("~/Home/LogOn")" + '?name=' + name + '&password=' + password;
        $.ajax({
            type: "post",
            url: url,
            data: "",
            dataType: "text",
            success: function (msg) {
                if (msg == "true") {
                    var openurl = "@Url.Content("~/Question/QuestionIndex")";
                    window.location.href=openurl;
                } else {
                    alert(msg);
                }
            }
        });
    }

</script>

</html>